# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=php82-pecl-opentelemetry
_extname=opentelemetry
pkgver=1.0.0
pkgrel=0
pkgdesc="PHP 8.2 extension for OpenTelemetry auto-instrumentation support - PECL"
url="https://pecl.php.net/package/opentelemetry"
arch="all"
license="Apache-2.0"
_phpv=82
_php=php$_phpv
depends="$_php-common"
makedepends="$_php-dev"
source="php-pecl-$_extname-$pkgver.tgz::https://pecl.php.net/get/$_extname-$pkgver.tgz"
builddir="$srcdir/$_extname-$pkgver"

build() {
	phpize$_phpv
	./configure --prefix=/usr --with-php-config=php-config$_phpv
	make
}

check() {
	$_php -d extension="$builddir"/modules/$_extname.so --ri $_extname
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test TESTS=--show-diff
}

package() {
	make INSTALL_ROOT="$pkgdir" install
	local _confdir="$pkgdir"/etc/$_php/conf.d
	mkdir -p $_confdir
	echo "extension=$_extname" > $_confdir/$_extname.ini
}

sha512sums="
6e4222bf5df4af62876944265f653c6ba9a3007ce1b896fa8b1879fb8cf369486ae6cd42041def1e7606c5c7e7820b9cc070aed7cdeab61900db3a9d7b2309cd  php-pecl-opentelemetry-1.0.0.tgz
"
